<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
  defined('_JEXEC') or die('Retricted Access');
  global $option,$jbconfig;
?>

<script type="text/javascript" language="javascript">
//<![CDATA[
function submitbutton(pressbutton) {
	var form = document.adminForm;

	if (pressbutton == 'cancel') {
		form.view.value ='jaemployers';
		submitform( pressbutton );
	}
    
	if ( pressbutton == 'send'){
		
		if(form.emails.value == '' ){
		    alert('<?php echo JText::_('Receiver mail could not be empty')?>');
			form.subject.focus();
			return;
		}
		if(form.subject.value == '' ){
		    alert('<?php echo JText::_('Email subject could not be empty')?>');
			form.subject.focus();
			return;
		}

		if (form.content.value=='')
		{
			if (!confirm('<?php echo JText::_('Email content is empty. Do you want to send this mail?'); ?>'))
				return;
		}
		
		submitform( pressbutton );
	}					
	else {
		submitform( pressbutton );
	}
}

function insertVariable(el){
    if (!el.selectedIndex) return;
    txt = el.form.elements.content;
    txt.value = txt.value + el.options[ el.selectedIndex ].value;
    el.selectedIndex = -1;
}
function formReload(frm, reload){
    frm.elements.reload.value = reload;
    frm.submit();
}
//]]>
</script>
<form name="adminForm" action="index.php" method="post">
    <table width="100%">
		<tr>
		
		<td width="80%" valign="top">
			<div style="width:100%;">
				<fieldset>
				<legend><?php echo JText::_('Send Mail Form');?></legend>
					<table class="admintable">
			        	<tr>
			        		<td class="key" width="20%" align="right">
								<?php echo JText::_( 'To' ); ?>:
							</td>				
							<td width="80%">
								<input type="text" value="<?php echo $this->emails; ?>" name="emails" style="width:500px"/>
								<font color="Red">*</font>
							</td>
			        	</tr>	
			        
			        	<tr>
			        		<td class="key" width="20%" align="right">
								<?php echo JText::_( 'From' ); ?>:
							</td>
							
							<td width="80%">
								<input type="text" value="<?php echo $jbconfig['emails']->get('fromemail'); ?>" name="email_from" style="width:500px"/>
							</td>				
			        	</tr>
			        	
			            <tr>
			                <td class="key"><?php echo JText::_("Subject"); ?></td>
			                <td>
			                    <input type="text" value="" name="subject" style="width:500px"/>
			                    <font color="Red">*</font>
			                </td>
			            </tr>   
			            
			             <tr>
			                <td class="key"><?php echo JText::_("Content"); ?></td>
			                <td>
			                	<textarea name="content" cols="80" rows="20" id="content"></textarea>
			                    <?php //echo $this->editor->display('content',  $value , '100%', 400, '10', '5' ) ;?>
			                </td>
			            </tr>        	
			        	<tr>
			        		<td class="key" width="20%" align="right">
								<?php echo JText::_( 'E-Mail Variables' ); ?>:
							</td>
							<td width="80%" bgcolor="White">
								<?php echo $this->tags?>
							</td>
			        	</tr>			        	
			    	</table>
			    </fieldset>    
			</div>
		</td>
	</tr>
	</table>
	<input type="hidden" name="pre_view" value="<?php echo JRequest::getVar('pre_view'); ?>" />
	<input type="hidden" name="user_id" value="<?php echo JRequest::getVar('cid'); ?>" />
	<input type="hidden" name="option" value="<?php echo $option; ?>" />
	<input type="hidden" name="view" value="jamail" />
	<input type="hidden" name="task" value="" />
	<?php echo JHTML::_( 'form.token' ); ?>	
 </form>
